package tools;

import service.ServerThread;
import view.ServerView;

import java.util.Hashtable;

public class ThreadManage {

    private static Hashtable<Integer, ServerThread> threads = new Hashtable<>();

    public static Hashtable<Integer, ServerThread> getThreads() {
        return threads;
    }

    public static void addThread(int qq, ServerThread thread) {
        threads.put(qq, thread);
        ServerView.setThreadCount();
    }

    public static ServerThread getThread(int qq) {
        return threads.get(qq);
    }

    public static void removeThread(int qq) {
        threads.remove(qq);
        ServerView.setThreadCount();
    }
}
